/**
 * author: zhou
 * date: 2017.10.23
 * description: 学生模型
 * {
 *      name: 学生名称
 *      studentId: 学号
 *      school: 所属学校id
 *      grade: 所属年级id
 *      class: 所属班级id
 *      birthday: 出生日期
 *      sex: 性别 1 男 2 女
 *      parents: 父母姓名手机号码
 *      status: 状态 1 正常 2 删除
 * }
 */

const mongoose = require('mongoose');

const studentSchema = new mongoose.Schema({
    name: { type: String, required: true },
    studentId: { type: String, required: true },
    parentName: { type: String, required: true },
    parentPhone: { type: String, required: true },
    schoolId: { type: mongoose.Schema.Types.ObjectId, ref: 'School', required: true },
    gradeId: { type: mongoose.Schema.Types.ObjectId, ref: 'Grade', required: true },
    classId: { type: mongoose.Schema.Types.ObjectId, ref: 'Class', required: true },
    idCard: { type: String, required: true },
    birthday: { type: String, required: true },
    sex: { type: Number, default: 1 },
    status: { type: Number, default: 1 },
    createDate: { type: Date, default: Date.now }
});

module.exports = mongoose.model('Student', studentSchema, 'schools.settings.students');